<?php

class Material_model extends CI_Model 
{
    function __construct()
    {
        parent::__construct();
    }
	
	function get_materials($name = null, $code = null)
	{
		$this->db->from('material');
		
		if($name && $name != '-')
		{
			$this->db->where('name LIKE \'%' . $name . '%\'');
		}
		
		if($code)
		{
			$this->db->where('code LIKE \'%' . $code . '%\'');
		}
		
		$query = $this->db->get();
		
		return $query->result();
	}
}